]>
Commit | Line | Data |
---|---|---|
2faffece P |
1 | IDENTIFICATION DIVISION |
2 | PROGRAM-ID Damped_Oscillator | |
3 | ||
4 | ENVIRONMENT DIVISION | |
5 | ENGINE Anabrid-THAT | |
6 | REQUIRES COEFFICIENT 5 | |
7 | REQUIRES INTEGRATOR 2 | |
8 | REQUIRES INVERTER 1 | |
9 | REQUIRES SUMMER 2 | |
10 | ||
11 | DATA DIVISION | |
f25252dd | 12 | OUTPUT OUTPUT.U y |
2faffece P |
13 | ALIAS COEFFICIENT.1 InitialPosition |
14 | ALIAS COEFFICIENT.2 InitialSpeed | |
15 | ALIAS COEFFICIENT.3 SpringForce | |
16 | ALIAS COEFFICIENT.4 Damping # linear to speed | |
17 | ALIAS COEFFICIENT.5 Mass # 1 / mass | |
18 | ||
19 | PROGRAM DIVISION | |
20 | # Colors being used for wiring | |
21 | # - black: y0 | |
22 | # - blue: y0’ | |
23 | # - green: y0’’ | |
24 | # - yellow: y’’, y’ | |
25 | # - red: y | |
26 | -1 -> InitialPosition -> -y0 # -initial position of the mass | |
27 | -1 -> InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1 | |
28 | +1, y0s’, y0s’ -> Summer.1 -> y0’ | |
29 | y’’, IC:y0’ -> INTEGRATOR.1 -> -y’ | |
30 | -y’,IC:-y0 -> INTEGRATOR.2 -> y | |
31 | y -> SpringForce -> S*y # springforce times displacement | |
32 | -y’ -> INVERTER.1 -> y’ | |
33 | y’ -> Damping -> D*y’ # damping times speed | |
34 | S*y, D*y’ -> SUMMER.2 -> -(Dy’+Sy) | |
35 | -(Dy’+Sy) -> Mass -> -1/m*(Dy’+Sy)=y’’ | |
36 | ||
37 | OPERATION DIVISION | |
38 | MODE REPEAT | |
39 | OP-TIME 80ms |